import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CoachVO, CoachForm, CoachQuery } from '@/api/primary/coach/types';

/**
 * 查询教练信息列表
 * @param query
 * @returns {*}
 */

export const listCoach = (query?: CoachQuery): AxiosPromise<CoachVO[]> => {
  return request({
    url: '/primary/coach/list',
    method: 'get',
    params: query
  });
};
export const listCoacha = (id: string | number) => {
  console.log(id,'jiaolianxid')
  return request({
    url: '/system/user/list/role/' + id,
    method: 'get',
  });
};
/**
 * 查询教练信息详细
 * @param id
 */
export const getCoach = (id: string | number): AxiosPromise<CoachVO> => {
  return request({
    url: '/primary/coach/' + id,
    method: 'get'
  });
};

/**
 * 新增教练信息
 * @param data
 */
export const addCoach = (data: CoachForm) => {
  return request({
    url: '/primary/coach',
    method: 'post',
    data: data
  });
};

/**
 * 修改教练信息
 * @param data
 */
export const updateCoach = (data: CoachForm) => {
  return request({
    url: '/primary/coach',
    method: 'put',
    data: data
  });
};

/**
 * 删除教练信息
 * @param id
 */
export const delCoach = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/coach/' + id,
    method: 'delete'
  });
};
